
#Region " Copyright Notice"
' ====================================================================
'* The UncleGED Open Source Software License
'*
'* Copyright (c) 1999-2009 D. M. DeBacker. All rights reserved.
'* http://gatheringleaves.org/uged
'*
'* Redistribution and use in source and binary forms, with or without
'* modification, are permitted provided that the following conditions
'* are met:
'*
'* 1. Redistributions of source code must retain the above copyright
'*    notice, this list of conditions and the following disclaimer.
'*
'* 2. Redistributions in binary form must reproduce the above copyright
'*    notice, this list of conditions and the following disclaimer in
'*    the documentation and/or other materials provided with the
'*    distribution.
'*
'* 3. Products derived from this software may not be called "UncleGED",
'*    nor may "UncleGED" appear in their name, without prior written
'*    permission of D. M. DeBacker.
'*
'* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
'* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
'* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
'* DISCLAIMED.  IN NO EVENT SHALL D. M. DEBACKER BE LIABLE FOR ANY
'* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
'* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
'* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
'* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
'* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
'* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
'* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'* ====================================================================
#End Region

Imports System.IO

Public Class FolderMethods
    ''' <summary>
    ''' Get the path of the executing assembly
    ''' </summary>
    ''' <returns>Path</returns>
    Public Shared Function GetAppPath() As String
        Dim sPath As String = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
        Return sPath
    End Function

    ''' <summary>
    ''' Returns the path to the "My UncleGED" directory
    ''' </summary>
    ''' <returns>Path</returns>
    Public Shared Function GetUserPath() As String
        Dim sPath As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments

        If sPath.EndsWith("\") = False Then
            sPath &= "\"
        End If

        sPath &= "My UncleGED"
        Return sPath
    End Function

    ''' <summary>
    ''' Returns the path to the "My Document" with an appended sub-folder
    ''' </summary>
    ''' <returns>Path</returns>
    Public Shared Function GetUserPath(ByVal FolderName As String) As String
        Dim sPath As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments

        If sPath.EndsWith("\") = False Then
            sPath &= "\"
        End If

        sPath &= FolderName
        Return sPath
    End Function

    ''' <summary>
    ''' Get the path of the My Documents directory
    ''' </summary>
    ''' <returns>Path</returns>
    Public Shared Function GetMyDocuments() As String
        Dim sPath As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments

        If sPath.EndsWith("\") = False Then
            sPath &= "\"
        End If

        Return sPath
    End Function

End Class
